package exception;

import java.text.ParseException;
import java.text.SimpleDateFormat;

public class ExceptionDemo1 {
    public static void main(String[] args) throws ParseException {

        // ArrayIndexOutOfBoundsException 索引越界异常
        int[] arr = {1, 2, 3, 4, 5};
        System.out.println(arr[10]);


        // NullPointerException 空指针异常
        String s = null;
        System.out.println(s.equals("嘿嘿"));

        // ParseException 模式解析异常
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
        sdf.parse("2024-1月1日");
    }
}
